package com.example.Annocation.factoryBean;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Description TODO
 * @Date 2024/5/14 20:46
 * @Created by houjunfeng
 */
public class MyFactoryBeanTest {
    ApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(MyFactoryConfigeration.class);
    @Test
    public void test01(){
        Object object = annotationConfigApplicationContext.getBean("MyFactoryBean");
        System.out.println(object);


        //获取MyBeanFactory
        Object object1 = annotationConfigApplicationContext.getBean("&MyFactoryBean");
        System.out.println(object1);

        String[] students = annotationConfigApplicationContext.getBeanDefinitionNames();
        for(String s:students){
            System.out.println(s);
        }
    }
}
